App.controller('myOrderPayController', ['$rootScope', '$scope', '$state', '$window', 'Page',function($rootScope, $scope, $state, $window, Page) {
	$scope.orderId = $state.params.orderId;
	$scope.confirm = $state.params.confirm;
	
	Page.ajaxPost("app/order/details.do",{orderId : $scope.orderId},function(resp){
        $scope.order = resp.data;
        if($scope.confirm == '1'){//是支付确认
        	if($scope.order && $scope.order.status == '3'){
        		Page.alert('订单已支付成功 !',function(){
            		$state.go('user.order', {orderId : $scope.orderId});
            	});
        	}else{
        		Page.alert('订单支付失败 !');
        	}
        }
    });
	
	$scope.payStyles = [{id : 'alipay', logo : './img/icon/alipay.png'}];
	
	$scope.selectPayStyle = function(style){
		$scope.payStyle = style.id;
		if($scope.payStyle== 'alipay'){
			Page.ajaxPost('app/website/pay.do',{'orderId' : $scope.orderId,'phone' : $rootScope.user.phone},function(resp) {
				$scope.alipayForm = resp.data.form;
			}); 
		}else{
			
		}
	};
	
}]);